﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PMS.Models.Base
{
    ///<summary>
    ///系统菜单表的实体类
    ///</summary>
    [Serializable]
    [Table("BaseMenu")]
    public class BaseMenu
    {
        /// <summary>
        /// 菜单表主键
        /// </summary>
        [Key]
        [Column("Id")]
        public int Id { get; set; }
        /// <summary>
        /// 菜单名称
        /// </summary>
        [Column("Title")]
        public string Title { get; set; }
        /// <summary>
        /// 菜单编号
        /// </summary>
        [Column("Sym")]
        public string Sym { get; set; }
        /// <summary>
        /// 取值
        /// </summary>
        [Column("Value")]
        public string Value { get; set; }
        /// <summary>
        /// 备注描述
        /// </summary>
        [Column("Remark")]
        public string Remark { get; set; }
        /// <summary>
        /// parentId
        /// </summary>
        [Column("ParentId")]
        public int ParentId { get; set; }
        /// <summary>
        /// 父节点名称
        /// </summary>
        [Column("ParentName")]
        public string ParentName { get; set; }
        /// <summary>
        /// 菜单子父路径 例如： .1.2.5.7
        /// </summary>
        [Column("Path")]
        public string Path { get; set; }
        /// <summary>
        /// 菜单子父路径 例如： .系统管理.权限管理.等
        /// </summary>
        [Column("PathName")]
        public string PathName { get; set; }
        /// <summary>
        /// 是否启用 1 启用 0停用
        /// </summary>
        [Column("Enable")]
        public int Enable { get; set; }
        /// <summary>
        /// 删除标识1表示删除0表示未删除
        /// </summary>
        [Column("IsDel")]
        public int IsDel { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [Column("CreateBy")]
        public int CreateBy { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("CreateDate")]
        public System.DateTime CreateDate { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        [Column("ModifyBy")]
        public int ModifyBy { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        [Column("ModifyDate")]
        public System.DateTime ModifyDate { get; set; }
        /// <summary>
        /// 删除人
        /// </summary>
        [Column("DeleteBy")]
        public int DeleteBy { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        [Column("DeleteDate")]
        public System.DateTime DeleteDate { get; set; }


        public int _parentId
        {
            get { return ParentId; }
        }

        public string state
        {
            get { return (IsLeaf == 0 ? true : false) ? "open" : "closed"; }
        }

        /// <summary>
        /// 是否子叶
        /// </summary>
        public int IsLeaf { get; set; }


        /// <summary>
        /// 排序字段
        /// </summary>
        [Column("Sort")]
        public int Sort { get; set; }

        /// <summary>
        /// Url地址
        /// </summary>
        [Column("UrlAddress")]
        public string UrlAddress { get; set; }

        /// <summary>
        /// 图标名称
        /// </summary>
        [Column("IocName")]
        public string IocName { get; set; }
    }
}